﻿using System;
using System.Windows.Forms;
using Seagull.Configuration;
using Seagull.TestDataGen;
using Seagull.TestGeneric;

namespace Seagull.Shell.Tests
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.SetCompatibleTextRenderingDefault(false);
            Config.Load("Config\\config.xml");
            Config.Instance.PathConfig.RawDataPath =
                DirectoryHelper.CreateTempFolder(postfix: "source");
            Config.Instance.PathConfig.CompressTempPath =
                DirectoryHelper.CreateTempFolder(postfix: "zip");
            Config.Instance.PathConfig.StatPath =
                DirectoryHelper.CreateTempFolder(postfix: "stat");
            Config.Instance.PathConfig.ChannelStatPath =
                DirectoryHelper.CreateTempFolder(postfix: "stat2");
            Config.Instance.PathConfig.DcuIpAddress = "0.0.0.0";

            Application.ApplicationExit+=(sender, e) =>
            {
                DirectoryHelper.DeleteIfExist(Config.Instance.PathConfig.RawDataPath);
                DirectoryHelper.DeleteIfExist(Config.Instance.PathConfig.CompressTempPath);
                DirectoryHelper.DeleteIfExist(Config.Instance.PathConfig.StatPath);
                DirectoryHelper.DeleteIfExist(Config.Instance.PathConfig.ChannelStatPath);
            };

            //            SourceDataHelper.PrepareDatesWithData(new[]
            //            {
            //                MaintenanceJob.OldestDateToKeepRawData.AddDays(-3), 
            //                MaintenanceJob.OldestDateToKeepRawData.AddDays(-2),
            //                MaintenanceJob.OldestDateToKeepRawData.AddDays(-1),
            //            });
            new TestDataGenControlWindow().Show();
            //            Application.Run(new TestDataGenControlWindow());
            Shell.Program.Start();
        }
    }
}
